package com.sgb.jicai.view.activity;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.text.InputFilter;
import android.text.InputType;
import android.text.TextUtils;
import android.view.View;
import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
import com.bigkoo.pickerview.builder.TimePickerBuilder;
import com.bigkoo.pickerview.listener.OnOptionsSelectListener;
import com.bigkoo.pickerview.view.OptionsPickerView;
import com.bigkoo.pickerview.view.TimePickerView;
import com.sgb.jicai.R;
import com.sgb.jicai.databinding.ActivityJcDemanderpublishBinding;
import com.sgb.jicai.entity.AttrsListBean;
import com.sgb.jicai.entity.BaseAddFiledBean;
import com.sgb.jicai.entity.CommodityParamValBean;
import com.sgb.jicai.entity.CommodityUseAddFiledBean;
import com.sgb.jicai.entity.DemanderCompanyPublishBeans;
import com.sgb.jicai.entity.FilterEntity;
import com.sgb.jicai.entity.FreightRulesBean;
import com.sgb.jicai.entity.GoodsDetailBean;
import com.sgb.jicai.entity.GroupbuyingRuleCustomizeFieldsBean;
import com.sgb.jicai.entity.GroupbuyingRuleDTOBean;
import com.sgb.jicai.entity.JiCaiCustomFieldBean;
import com.sgb.jicai.entity.JiCaiPublishListBean;
import com.sgb.jicai.entity.JoinRequireCustomizeFieldsBean;
import com.sgb.jicai.entity.PushRulesBean;
import com.sgb.jicai.entity.ReceiversBean;
import com.sgb.jicai.entity.ShoplistBean;
import com.sgb.jicai.entity.SuperviseListBean;
import com.sgb.jicai.view.adapter.DetailedAdapter;
import com.sgb.jicai.view.adapter.MethodAdapter;
import com.sgb.jicai.view.adapter.SuperviseAdapter;
import com.sgb.jicai.viewmodel.DemanderPublishModel;
import com.sgb.link.entity.PublicTypeEntity;
import com.sgb.link.entity.ReturnTypeEntity;
import com.swgk.core.base.AppActivity;
import com.swgk.core.view.areapopup.AddressEntity;
import com.swgk.core.view.entity.GoodsPublishEntity;
import com.swgk.core.view.entity.MenuEntity;
import com.sgb.link.utils.NumericalTransformationTool;
import com.swgk.core.view.CityPickBuilder;
import com.swgk.core.view.CityPickView;
import com.swgk.core.view.pop.GoodsTypePopWindow;
import com.swgk.core.customview.ItemInputTextView;
import com.swgk.core.dialog.BasePopWindow;
import com.swgk.core.dialog.CommonDialog;
import com.swgk.core.recyclerview.adapter.AdapterOnItemClick;
import com.swgk.core.util.CheckUtils;
import com.swgk.core.util.DateUtils;
import com.swgk.core.util.MToast;
import com.swgk.core.util.SharedPreferenceUtil;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

/**
 * Time:2021/8/9
 * AUTHOR:F_Q
 * Description:1、需方发起发布界面  2、供方发起发布界面
 */
public class JiCaiDemanderPublishAct extends AppActivity implements ItemInputTextView.OnWholeItemClickListener {
    DemanderPublishModel viewModel;
    private ActivityJcDemanderpublishBinding binding;
    private String type;//1、需方发起发布界面  2、供方发起发布界面
    //按类型设置监督人的adapter
    String[] superviseListTitle = new String[]{"行贿受贿", "服务态度", "商业欺诈", "违约纠纷", "工作作风", "工作纠偏", "其他监督人"};
    private SuperviseAdapter superviseadapter;
    List<SuperviseListBean> superviseList = new ArrayList<>();
    //用户列表
    private List<JiCaiPublishListBean> UserList;
    //省市区三级联动
    // 一级联动数据
    private List<AddressEntity<List<AddressEntity<List<AddressEntity>>>>> addressEntityList;
    // 二级联动数据
    private List<List<AddressEntity<List<AddressEntity>>>> opt2 = new ArrayList<>();
    // 三级联动数据
    private int cityPosition1;
    private int cityPosition2;
    //公司名称
    private String company_name = "";
    //公司no
    private String company_no = "";
    //用户名称
    private String userName = "";
    //公司列表数据
    private List<JiCaiPublishListBean> companyList;
    //发布数据实体bean
    private DemanderCompanyPublishBeans bean;
    //部门列表
    private List<JiCaiPublishListBean> departmentList;
    //付款类型
    private List<JiCaiPublishListBean> paymentList;
    //发票类型
    private List<JiCaiPublishListBean> invoiceList;
    //税率列表
    private List<JiCaiPublishListBean> taxRateList;
    //集采单位列表
    private List<JiCaiPublishListBean> unitList;
    //商品列表
    private List<MenuEntity<MenuEntity<MenuEntity>>> goodsTypeEntityList;
    //商品弹窗
    private GoodsTypePopWindow goodsTypePopWindow;
    //质保周期
    private List<JiCaiPublishListBean> DepositRateUnit;
    //质保周期
    private List<JiCaiPublishListBean> timeUnit;
    //集采类型
    private List<JiCaiPublishListBean> jicaiTypeList;
    //供方要求
    private List<JiCaiPublishListBean> supplierRequireList;
    //注册资金
    private List<JiCaiPublishListBean> registeredFundList;
    //经营业绩
    private List<JiCaiPublishListBean> operationResultList;
    //存货要求
    private List<JiCaiPublishListBean> inventoryRequirementsList;
    //专业要求
    private List<JiCaiPublishListBean> professionRequireList;
    private Intent intent;
    private Bundle bundle;
    //机械列表
    private List<PublicTypeEntity<List<PublicTypeEntity>>> publicTypeEntityList;
    //机械返回数据
    private ReturnTypeEntity returnTypeEntity;
    //设备列表
    private List<PublicTypeEntity<List<PublicTypeEntity>>> equipmentList;
    //商品sku属性列表
    private List<CommodityParamValBean> skuList;
    //物料清单adapter
    private DetailedAdapter adapter;
    //物料清单数据集合
    private List<ShoplistBean> shoplist;
    //集采规则
    private GroupbuyingRuleDTOBean dtoBean;
    //服务费收起方式
    private List<JiCaiPublishListBean> chargeWayList;
    //送货方式
    private List<JiCaiPublishListBean> shippingMethodList;
    //发起方配送Adapter
    private MethodAdapter methodadapter;
    //机械和设备信息
    private List<FilterEntity<List<FilterEntity>>> filterList;
    private PushRulesBean joinpush;
    private PushRulesBean offerpush;
    private String unit;

    @Override
    protected void initView() {
        super.initView();
        bean = new DemanderCompanyPublishBeans();
        //可以为空但是必传
        bean.setManufactorCredentials("");
        bean.setRegisteredCapital("");
        bean.setOperatingPerformance("");
        bean.setInventoryRequirements("");
        bean.setMajorCredentials("");
        binding = DataBindingUtil.setContentView(this, R.layout.activity_jc_demanderpublish);
        viewModel = new ViewModelProvider(this).get(DemanderPublishModel.class);
        viewModel.setActivity(JiCaiDemanderPublishAct.this);
        type = getIntent().getStringExtra("type");
        binding.topLayout.ivBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
        switch (type) {
            case "1":
                binding.topLayout.titleView.setText("需方发起");
                break;
            case "2":
                binding.topLayout.titleView.setText("企业专项");
                break;
        }
        //集采规则
        dtoBean = new GroupbuyingRuleDTOBean();
        if (TextUtils.equals(type, "1")) {
            //集采规则-加盟/报价身份
            dtoBean.setJoinTraderType("1");//加盟方身份要求 1公司及个人 2公司
            dtoBean.setOfferTraderType("1");//报价方身份要求 1公司及个人 2公司
        }
        joinpush = new PushRulesBean();
        offerpush = new PushRulesBean();
        //集采规则-加盟/报价通知
        dtoBean.setLoadType("1");//装车要求 1 供方承担 2 需方承担 3发起方承担
        dtoBean.setUploadType("1");//装车要求 1 供方承担 2 需方承担 3发起方承担
        ViewOnClick();//初始化点击事件
        basicsView();//基础信息模块view初始化
        initPopWindow();//初始化商品弹窗信息
        adapterView("1");//初始化集采清单初始化
    }

    private void adapterView(String groupbuyClass) {
        List<ShoplistBean> shoplistBeans = new ArrayList<>();
        ShoplistBean shoplistBean = new ShoplistBean();
        shoplistBean.setIndex(1);
        shoplistBean.setGroupbuyClass(groupbuyClass);
        shoplistBean.setNum("");
        shoplistBean.setRangeBrands("");
        shoplistBean.setExitTime("");
        shoplistBean.setEntranceTime("");
        shoplistBean.setStartTime("");
        shoplistBean.setPickTime("");
        shoplistBean.setGoodsMaterial("");//商品材料
        shoplistBean.setGoodsQuality("");//质量标准
        shoplistBean.setGoodsMaintenance("");//维修保养
        shoplistBean.setGoodsPurpose("");//商品用途
        shoplistBean.setGoodsDescribe("");//特征描述
        shoplistBeans.add(shoplistBean);
        adapter = new DetailedAdapter(this, shoplistBeans);
        binding.demanderList.jicaiList.setLayoutManager(new LinearLayoutManager(getActivity()));
        binding.demanderList.jicaiList.setAdapter(adapter);
        adapter.setOnDelete(new DetailedAdapter.onDelete() {
            @Override
            public void Delete(int pos) {
                if (adapter.getDatas().size() > 1) {
                    shoplist.remove(pos);
                    if (shoplist.size()>0){
                        for (int i = 0; i < shoplist.size(); i++) {
                            shoplist.get(i).setIndex(i + 1);
                        }
                    }
                    adapter.setDatas(shoplist);
                    adapter.notifyDataSetChanged();
                }
            }
        });
    }

    @Override
    protected void init() {
        super.init();
        company_name = SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.COMPANY_NAME, "");
        company_no = SharedPreferenceUtil.getInstance().getString(SharedPreferenceUtil.COMPANY_NO, "");
        userName = SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.REAL_NAME, "");
        viewModel.getCompanyList(new View(this), false);//调用接口获取主企业id
        viewModel.getUserList(new View(this), false);
        //发布列表初始化字段值
        bean.setPickCompanyName(company_name);//发起方公司名字
        bean.setCreateCompany(company_name);//发起方公司名字
        binding.demanderBasics.basic.publishUnits.setContent(company_name);//发起单位
        binding.demanderBasics.basic.contactName.setContent(userName);//联系人
        bean.setContacts(userName);//联系人
        //联系电话
        binding.demanderBasics.basic.contact.setContent(SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.LOGIN_PHONE, "") + "");
        binding.demanderBasics.basic.contact.setInfilterType(ItemInputTextView.TYPE_PHONE);
        bean.setContactNumber(binding.demanderBasics.basic.contact.getContent());//联系电话
        binding.demanderBasics.basic.jicaiType.setContent("商品材料");//集采类型
        bean.setGroupbuyClass("1");
        //函询接收人
        binding.demanderBasics.basic.letterReceiveName.setContent(userName);
        bean.setInquiryUserName(userName);
        //监督接收人
        binding.demanderBasics.basic.superviseReceiveName.setContent(userName);
        binding.demanderBasics.basic.communicationReceiveName.setContent(userName);
        bean.setSuperviseType("1");//监督人设置类型 1 统一设置监督人 2按类型设置监督人
        bean.setGroupBuyType("1");//集采类型: 1、即报即采 2 汇总集采
        binding.demanderBasics.jicai.deadline.setVisibility(View.GONE);//隐藏集采截止时间
        binding.demanderBasics.jicai.jicaitypeLine.setVisibility(View.GONE);//隐藏集采截止时间
        switch (type) {
            case "1"://需方发起
                bean.setGroupbuyMode("1");
                binding.demanderBasics.jicai.llJoinRequire.setVisibility(View.GONE);//加盟和报价要求不显示
                binding.demanderRule.join.getRoot().setVisibility(View.VISIBLE);
                break;
            case "2"://企业专项
                bean.setJoinType("1");//1，会员，2市场,3成员
                bean.setOfferType("1");//1，会员，2市场,3成员
                bean.setGroupbuyMode("2");
                binding.demanderRule.join.getRoot().setVisibility(View.GONE);
                binding.demanderBasics.jicai.llJoinRequire.setVisibility(View.VISIBLE);//加盟和报价要求不显示
                break;
        }
        bean.setQuailtyCycleUnit("日");
        //集采规则

    }

    /**
     * 初始化点击事件
     */
    private void ViewOnClick() {
        //主按钮
        binding.demanderBasics.nextStep.setOnClickListener(this);//基础信息下一步
        binding.demanderList.nextStepTwo.setOnClickListener(this);//集采清单下一步
        binding.demanderList.previousStepOne.setOnClickListener(this);//集采清单上一步
        binding.demanderRule.previousStepTwo.setOnClickListener(this);//上一步
        binding.demanderRule.submit.setOnClickListener(this);//提交
        //基础信息
        binding.demanderBasics.basic.publishUnits.setOnWholeItemClickListener(this);//发起单位
        binding.demanderBasics.basic.startDepartment.setOnWholeItemClickListener(this);//发起部门
        binding.demanderBasics.basic.shippingAddress.setOnWholeItemClickListener(this);//收货地址
        binding.demanderBasics.basic.jicaiType.setOnWholeItemClickListener(this);//集采类型
        binding.demanderBasics.basic.jicaiScope.setOnWholeItemClickListener(this);//集采范围
        binding.demanderBasics.basic.letterReceiveName.setOnWholeItemClickListener(this);//函询接收人
        binding.demanderBasics.basic.communicationReceiveName.setOnWholeItemClickListener(this);//交流信息接收人
        //监督方式
        binding.demanderBasics.basic.llUnifySuperintendent.setOnClickListener(this);//统一设置监督人
        binding.demanderBasics.basic.llTypeSuperintendent.setOnClickListener(this);//按类型设置监督人
        binding.demanderBasics.basic.superviseReceiveName.setOnWholeItemClickListener(this);//监督接收人
        //集采方式
        binding.demanderBasics.jicai.llNamelyMining.setOnClickListener(this);//即报即采
        binding.demanderBasics.jicai.llPooledProcurement.setOnClickListener(this);//汇集采购
        binding.demanderBasics.jicai.deadline.setOnWholeItemClickListener(this);//集采截止时间
        binding.demanderBasics.jicai.llCustomersJoin.setOnClickListener(this);//客户加盟
        binding.demanderBasics.jicai.llMarketJoin.setOnClickListener(this);//市场加盟
        binding.demanderBasics.jicai.llMembersJoin.setOnClickListener(this);//成员加盟
        binding.demanderBasics.jicai.llCustomerOffer.setOnClickListener(this);//客户报价
        binding.demanderBasics.jicai.llMarketOffer.setOnClickListener(this);//市场报价
        binding.demanderBasics.jicai.llMembersOffer.setOnClickListener(this);//成员报价
        //加盟方式
        binding.demanderBasics.join.paymentType.setOnWholeItemClickListener(this);//付款方式
        //报价要求
        binding.demanderBasics.offer.supplierRequire.setOnWholeItemClickListener(this);//供方要求
        binding.demanderBasics.offer.registeredFund.setOnWholeItemClickListener(this);//注册资金
        binding.demanderBasics.offer.operationResult.setOnWholeItemClickListener(this);//经营业绩
        binding.demanderBasics.offer.inventoryRequirements.setOnWholeItemClickListener(this);//存货要求
        binding.demanderBasics.offer.professionRequire.setOnWholeItemClickListener(this);//专业要求
        binding.demanderBasics.offer.llTimeUnit.setOnClickListener(this);//质保周期单位
        binding.demanderBasics.offer.llDepositRateUnit.setOnClickListener(this);//质保金单位
        binding.demanderBasics.offer.invoiceType.setOnWholeItemClickListener(this);//发票类型
        binding.demanderBasics.offer.taxRate.setOnWholeItemClickListener(this);//税率
        binding.demanderBasics.offer.llCbOk.setOnClickListener(this);//是否携带驾驶员
        binding.demanderBasics.offer.llCbNo.setOnClickListener(this);//是否携带驾驶员
        //输入监听处理
        binding.demanderBasics.basic.contactMethod.setInfilterType(ItemInputTextView.TYPE_PHONE);//负责人联系方式
        binding.demanderBasics.basic.contact.setInfilterType(ItemInputTextView.TYPE_PHONE);//联系方式
        //集采采购起始量
        NumericalTransformationTool.OnItemInputTextViewChange(binding.demanderBasics.join.initialEnergy);
        binding.demanderBasics.join.initialEnergy.setInfilterType(ItemInputTextView.TYPE_NUM);//纯数字
        //定金比例
        NumericalTransformationTool.OnItemInputTextViewChange(binding.demanderBasics.join.depositRate);
        binding.demanderBasics.join.depositRate.setInfilterType(ItemInputTextView.TYPE_AGE);//1-99
        //邮箱
        NumericalTransformationTool.OnItemInputTextViewChange(binding.demanderBasics.basic.eMail);
        //质保金
        NumericalTransformationTool.setMonitor(binding.demanderBasics.offer.depositRate);
        binding.demanderBasics.offer.depositRate.setInputType(InputType.TYPE_CLASS_NUMBER);//纯数字
        //质保周期
        NumericalTransformationTool.setMonitor(binding.demanderBasics.offer.guaranteeTime);
        binding.demanderBasics.offer.guaranteeTime.setInputType(InputType.TYPE_CLASS_NUMBER);//纯数字

        //付款比例
        NumericalTransformationTool.setMonitor(binding.demanderBasics.join.paymentRatio);
        binding.demanderBasics.join.paymentRatio.setInputType(InputType.TYPE_CLASS_NUMBER);//纯数字
        //尾款周期
        NumericalTransformationTool.setMonitor(binding.demanderBasics.join.paymentPeriod);
        binding.demanderBasics.join.paymentPeriod.setInputType(InputType.TYPE_CLASS_NUMBER);//纯数字
        //服务费收取比例
        NumericalTransformationTool.setMonitor(binding.demanderRule.serviceCharge.costRatio);
        binding.demanderRule.serviceCharge.costRatio.setInputType(InputType.TYPE_CLASS_NUMBER);//纯数字
        //费用
        NumericalTransformationTool.setMonitor(binding.demanderRule.serviceCharge.money);
        binding.demanderRule.serviceCharge.money.setInputType(InputType.TYPE_CLASS_NUMBER);//纯数字

        //集采清单
        binding.demanderList.goodsType.setOnWholeItemClickListener(this);//商品类型
        binding.demanderList.unitMeasure.setOnWholeItemClickListener(this);//单位
        binding.demanderList.addDetailed.setOnClickListener(this);//新增
        //集采规则
        //加盟报价身份
        binding.demanderRule.join.llJoinAll.setOnClickListener(this);//公司及个人
        binding.demanderRule.join.llOfferAll.setOnClickListener(this);//公司
        binding.demanderRule.join.llJoinCompany.setOnClickListener(this);//公司及个人
        binding.demanderRule.join.llOfferCompany.setOnClickListener(this);//公司
        //加盟报价通知
        binding.demanderRule.offer.llFactionDays.setOnClickListener(this);//每三天
        binding.demanderRule.offer.llFactionWeek.setOnClickListener(this);//每周
        binding.demanderRule.offer.factionUser.setOnWholeItemClickListener(this);//通知人员
        binding.demanderRule.offer.llCountDays.setOnClickListener(this);//每三天
        binding.demanderRule.offer.llCountWeek.setOnClickListener(this);//每周
        binding.demanderRule.offer.countUser.setOnWholeItemClickListener(this);//通知人员
        //服务费收取
        binding.demanderRule.serviceCharge.chargeWay.setOnWholeItemClickListener(this);//收取方式
        //装卸车要求
        //装车要求
        binding.demanderRule.installUnload.llInstallSupplier.setOnClickListener(this);//供应方承担
        binding.demanderRule.installUnload.llInstallDemander.setOnClickListener(this);//需求方承担
        binding.demanderRule.installUnload.llInstallInitiator.setOnClickListener(this);//发起方承担
        //卸车要求
        binding.demanderRule.installUnload.llUnloadSupplier.setOnClickListener(this);//供应方承担
        binding.demanderRule.installUnload.llUnloadDemander.setOnClickListener(this);//需求方承担
        binding.demanderRule.installUnload.llUnloadInitiator.setOnClickListener(this);//发起方承担
        //送货方式
        binding.demanderRule.delivery.shippingMethod.setOnWholeItemClickListener(this);//送货方式
        binding.demanderRule.delivery.addDelivery.setOnClickListener(this);//添加配送方式


    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id == R.id.next_step) {//基础信息下一步
            oneNextStepData();
        } else if (id == R.id.next_step_two) {//集采清单下一步
            TwoNextStepData();
        } else if (id == R.id.previous_step_one) {//集采清单上一步
            binding.demanderBasics.getRoot().setVisibility(View.VISIBLE);
            binding.demanderList.getRoot().setVisibility(View.GONE);
            binding.demanderRule.getRoot().setVisibility(View.GONE);
            binding.demanderContentProgress.setProgressbar(25);
            binding.scrollview.scrollTo(0,0);
        } else if (id == R.id.previous_step_two) {//上一步
            binding.demanderBasics.getRoot().setVisibility(View.GONE);
            binding.demanderList.getRoot().setVisibility(View.VISIBLE);
            binding.demanderRule.getRoot().setVisibility(View.GONE);
            binding.demanderContentProgress.setProgressbar(75);
            binding.scrollview.scrollTo(0,0);
        } else if (id == R.id.submit) {//提交
            submitData();
        } else if (id == R.id.ll_unify_superintendent) {//统一设置监督人
            bean.setSuperviseType("1");
            binding.demanderBasics.basic.unifySuperintendent.setChecked(true);
            binding.demanderBasics.basic.typeSuperintendent.setChecked(false);
            //按类型设置监督人的列表布局隐藏
            binding.demanderBasics.basic.superviseList.setVisibility(View.GONE);
            //统一监督人
            binding.demanderBasics.basic.superviseReceiveName.setVisibility(View.VISIBLE);
        } else if (id == R.id.ll_type_superintendent) {//按类型设置监督人
            bean.setSuperviseType("2");
            binding.demanderBasics.basic.unifySuperintendent.setChecked(false);
            binding.demanderBasics.basic.typeSuperintendent.setChecked(true);
            //按类型设置监督人的列表布局展示
            binding.demanderBasics.basic.superviseList.setVisibility(View.VISIBLE);
            //统一监督人
            binding.demanderBasics.basic.superviseReceiveName.setVisibility(View.GONE);
        } else if (id == R.id.ll_namely_mining) {//即报即采
            bean.setGroupBuyType("1");//集采类型: 1、即报即采 2 汇总集采
            //集采截止时间隐藏
            binding.demanderBasics.jicai.deadline.setContent("");
            bean.setDeadline("");
            binding.demanderBasics.jicai.deadline.setVisibility(View.GONE);
            binding.demanderBasics.jicai.jicaitypeLine.setVisibility(View.GONE);
            binding.demanderBasics.jicai.namelyMining.setChecked(true);
            binding.demanderBasics.jicai.pooledProcurement.setChecked(false);
        } else if (id == R.id.ll_pooled_procurement) {//汇集采购
            bean.setGroupBuyType("2");//集采类型: 1、即报即采 2 汇总集采
            //集采截止时间显示
            binding.demanderBasics.jicai.deadline.setVisibility(View.VISIBLE);
            binding.demanderBasics.jicai.jicaitypeLine.setVisibility(View.VISIBLE);
            binding.demanderBasics.jicai.namelyMining.setChecked(false);
            binding.demanderBasics.jicai.pooledProcurement.setChecked(true);
        } else if (id == R.id.ll_customers_join) {//客户加盟
            bean.setJoinType("1");//1，会员，2市场,3成员
            binding.demanderBasics.jicai.customersJoin.setChecked(true);
            binding.demanderBasics.jicai.marketJoin.setChecked(false);
            binding.demanderBasics.jicai.membersJoin.setChecked(false);
        } else if (id == R.id.ll_market_join) {//市场加盟
            bean.setJoinType("2");//1，会员，2市场,3成员
            binding.demanderBasics.jicai.customersJoin.setChecked(false);
            binding.demanderBasics.jicai.marketJoin.setChecked(true);
            binding.demanderBasics.jicai.membersJoin.setChecked(false);
        } else if (id == R.id.ll_members_join) {//成员加盟
            bean.setJoinType("3");//1，会员，2市场,3成员
            binding.demanderBasics.jicai.customersJoin.setChecked(false);
            binding.demanderBasics.jicai.marketJoin.setChecked(false);
            binding.demanderBasics.jicai.membersJoin.setChecked(true);
        } else if (id == R.id.ll_customer_offer) {//客户报价
            bean.setOfferType("1");//1，会员，2市场,3成员
            binding.demanderBasics.jicai.customerOffer.setChecked(true);
            binding.demanderBasics.jicai.marketOffer.setChecked(false);
            binding.demanderBasics.jicai.membersOffer.setChecked(false);
        } else if (id == R.id.ll_market_offer) {//市场报价
            bean.setOfferType("2");//1，会员，2市场,3成员
            binding.demanderBasics.jicai.customerOffer.setChecked(false);
            binding.demanderBasics.jicai.marketOffer.setChecked(true);
            binding.demanderBasics.jicai.membersOffer.setChecked(false);
        } else if (id == R.id.ll_members_offer) {//成员报价
            bean.setOfferType("3");//1，会员，2市场,3成员
            binding.demanderBasics.jicai.customerOffer.setChecked(false);
            binding.demanderBasics.jicai.marketOffer.setChecked(false);
            binding.demanderBasics.jicai.membersOffer.setChecked(true);
        } else if (id == R.id.ll_cb_ok) {//是
            bean.setOfferOperator("1");//是否需要驾驶员 0否 1是
            binding.demanderBasics.offer.cbOk.setChecked(true);
            binding.demanderBasics.offer.cbNo.setChecked(false);
        } else if (id == R.id.ll_cb_no) {//否
            bean.setOfferOperator("0");//是否需要驾驶员 0否 1是
            binding.demanderBasics.offer.cbOk.setChecked(false);
            binding.demanderBasics.offer.cbNo.setChecked(true);
        } else if (id == R.id.ll_deposit_rate_unit) {//质保金单位
            if (DepositRateUnit == null) {
                viewModel.getDepositRateUnit(view);
            } else {
                showListPop("选择质保金", view, DepositRateUnit);
            }
        } else if (id == R.id.ll_time_unit) {//质保周期单位
            if (timeUnit == null) {
                viewModel.getTimeUnit(view);
            } else {
                showListPop("选择质保周期", view, timeUnit);
            }
        } else if (id == R.id.add_detailed) {//集采清单新增
            AddDetailedData(bean.getGroupbuyClass());//判断是否可以新增数据;
        } else if (id == R.id.ll_join_all) {//公司及个人-加盟身份
            dtoBean.setJoinTraderType("1");
            binding.demanderRule.join.cbJoinAll.setChecked(true);
            binding.demanderRule.join.cbJoinCompany.setChecked(false);
        } else if (id == R.id.ll_join_company) {//公司-加盟身份
            dtoBean.setJoinTraderType("2");
            binding.demanderRule.join.cbJoinAll.setChecked(false);
            binding.demanderRule.join.cbJoinCompany.setChecked(true);
        } else if (id == R.id.ll_offer_all) {//公司及个人-报价身份
            dtoBean.setOfferTraderType("1");
            binding.demanderRule.join.cbOfferAll.setChecked(true);
            binding.demanderRule.join.cbOfferCompany.setChecked(false);
        } else if (id == R.id.ll_offer_company) {//公司-报价身份
            dtoBean.setOfferTraderType("2");
            binding.demanderRule.join.cbOfferAll.setChecked(false);
            binding.demanderRule.join.cbOfferCompany.setChecked(true);
        } else if (id == R.id.ll_faction_days) {//每三天
            joinpush.setLevel("1");
            joinpush.setMqMode("1");
            binding.demanderRule.offer.cbFactionDays.setChecked(true);
            binding.demanderRule.offer.cbFactionWeek.setChecked(false);
        } else if (id == R.id.ll_faction_week) {//每周
            joinpush.setLevel("2");
            joinpush.setMqMode("1");
            binding.demanderRule.offer.cbFactionDays.setChecked(false);
            binding.demanderRule.offer.cbFactionWeek.setChecked(true);
        } else if (id == R.id.ll_count_days) {//每三天
            offerpush.setLevel("1");
            offerpush.setMqMode("2");
            binding.demanderRule.offer.cbCountDays.setChecked(true);
            binding.demanderRule.offer.cbCountWeek.setChecked(false);
        } else if (id == R.id.ll_count_week) {//每周
            offerpush.setLevel("2");
            offerpush.setMqMode("2");
            binding.demanderRule.offer.cbCountDays.setChecked(false);
            binding.demanderRule.offer.cbCountWeek.setChecked(true);
        } else if (id == R.id.ll_install_supplier) {//供应方承担-装车要求
            dtoBean.setLoadType("1");
            binding.demanderRule.installUnload.cbInstallSupplier.setChecked(true);
            binding.demanderRule.installUnload.cbInstallDemander.setChecked(false);
            binding.demanderRule.installUnload.cbInstallInitiator.setChecked(false);
        } else if (id == R.id.ll_install_demander) {//需求方承担-装车要求
            dtoBean.setLoadType("2");
            binding.demanderRule.installUnload.cbInstallSupplier.setChecked(false);
            binding.demanderRule.installUnload.cbInstallDemander.setChecked(true);
            binding.demanderRule.installUnload.cbInstallInitiator.setChecked(false);
        } else if (id == R.id.ll_install_initiator) {//发起方承担-装车要求
            dtoBean.setLoadType("3");
            binding.demanderRule.installUnload.cbInstallSupplier.setChecked(false);
            binding.demanderRule.installUnload.cbInstallDemander.setChecked(false);
            binding.demanderRule.installUnload.cbInstallInitiator.setChecked(true);
        } else if (id == R.id.ll_unload_supplier) {//供应方承担-卸车要求
            dtoBean.setUploadType("1");
            binding.demanderRule.installUnload.cbUnloadSupplier.setChecked(true);
            binding.demanderRule.installUnload.cbUnloadDemander.setChecked(false);
            binding.demanderRule.installUnload.cbUnloadInitiator.setChecked(false);
        } else if (id == R.id.ll_unload_demander) {//需求方承担-卸车要求
            dtoBean.setUploadType("2");
            binding.demanderRule.installUnload.cbUnloadSupplier.setChecked(false);
            binding.demanderRule.installUnload.cbUnloadDemander.setChecked(true);
            binding.demanderRule.installUnload.cbUnloadInitiator.setChecked(false);
        } else if (id == R.id.ll_unload_initiator) {//发起方承担-卸车要求
            dtoBean.setUploadType("3");
            binding.demanderRule.installUnload.cbUnloadSupplier.setChecked(false);
            binding.demanderRule.installUnload.cbUnloadDemander.setChecked(false);
            binding.demanderRule.installUnload.cbUnloadInitiator.setChecked(true);
        } else if (id == R.id.add_delivery) {//新增配送方式
            List<FreightRulesBean> datas = methodadapter.getDatas();
            for (FreightRulesBean data : datas) {
                if (TextUtils.isEmpty(data.getKilometers())) {
                    MToast.showToast(this, "请输入发送方配送公里数");
                    return;
                }
                if (TextUtils.isEmpty(data.getFreight())) {
                    MToast.showToast(this, "请输入发送方配送费用");
                    return;
                }
            }
            if (datas.size() < 5) {
                FreightRulesBean shiping = new FreightRulesBean();
                shiping.setUnitName(bean.getUnitName());
                shiping.setKilometers("");
                shiping.setFreight("");
                methodadapter.addData(shiping);
                //每次添加完数据后判断list大小，根据大小调整view布局
                if (methodadapter.getDatas().size() >= 5) {
                    binding.demanderRule.delivery.addDelivery.setVisibility(View.GONE);
                }
            }
        }
    }

    /**
     * 判断是否可以新增数据;
     *
     * @param groupbuyClass
     */
    private void AddDetailedData(String groupbuyClass) {
        List<String> linkedHashSet = new ArrayList<>();
        for (int i = 0; i < adapter.getDatas().size(); i++) {
            if (TextUtils.isEmpty(adapter.getDatas().get(i).getNum())) {
                MToast.showToast(this, "请填写第" + adapter.getDatas().get(i).getIndex() + "条采购量");
                return;
            }
            if (TextUtils.equals(adapter.getDatas().get(i).getGroupbuyClass(), "1")) {
                if (TextUtils.isEmpty(adapter.getDatas().get(i).getPickTime())) {
                    MToast.showToast(this, "请选择第" + adapter.getDatas().get(i).getIndex() + "条提货时间");
                    return;
                }
            } else {
                if (TextUtils.isEmpty(adapter.getDatas().get(i).getEntranceTime())) {
                    MToast.showToast(this, "请选择第" + adapter.getDatas().get(i).getIndex() + "条进场时间");
                    return;
                }
                if (TextUtils.isEmpty(adapter.getDatas().get(i).getExitTime())) {
                    MToast.showToast(this, "请选择第" + adapter.getDatas().get(i).getIndex() + "条结束时间");
                    return;
                }
            }

        }
        if (groupbuyClass.equals("1")) {
            ShoplistBean addshoplist = new ShoplistBean();//最外层
            List<AttrsListBean> attrsList = new ArrayList<>();
            if (skuList != null && skuList.size() > 0) {
                for (CommodityParamValBean valBean : skuList) {
                    AttrsListBean attrs = new AttrsListBean();
                    attrs.setName(valBean.getName());
                    attrs.setSku(valBean.getSku());
                    List<GoodsDetailBean> goodsDetailBeans = new ArrayList<>();
                    for (CommodityParamValBean.DataDTO datum : valBean.getData()) {
                        goodsDetailBeans.add(new GoodsDetailBean(datum.getBrandId(), datum.getBrandName()));
                    }
                    attrs.setGoodsDetailBeans(goodsDetailBeans);
                    attrsList.add(attrs);
                }
                addshoplist.setAttrs(attrsList);
                addshoplist.setIndex(adapter.getDatas().size() + 1);
                addshoplist.setNum("");
                addshoplist.setRangeBrands("");
                addshoplist.setExitTime("");
                addshoplist.setEntranceTime("");
                addshoplist.setStartTime(bean.getDeadline());
                addshoplist.setPickTime("");
                addshoplist.setGroupbuyClass(bean.getGroupbuyClass());
                addshoplist.setFirstType(bean.getFirstType());
                addshoplist.setFirstTypeName(bean.getFirstTypeName());
                addshoplist.setSecondType(bean.getSecondType());
                addshoplist.setSecondTypeName(bean.getSecondTypeName());
                addshoplist.setThirdType(bean.getThirdType());
                addshoplist.setThirdTypeName(bean.getThirdTypeName());
                addshoplist.setUnitName(bean.getUnitName());
                addshoplist.setGoodsMaterial("");//商品材料
                addshoplist.setGoodsQuality("");//质量标准
                addshoplist.setGoodsMaintenance("");//维修保养
                addshoplist.setGoodsPurpose("");//商品用途
                addshoplist.setGoodsDescribe("");//特征描述
                shoplist.add(addshoplist);
            }
            adapter.setDatas(shoplist);
            adapter.notifyDataSetChanged();
        } else {
            if (filterList != null && filterList.size() > 0) {
                List<AttrsListBean> attrsList = new ArrayList<>();
                for (FilterEntity<List<FilterEntity>> datum : filterList) {
                    AttrsListBean att = new AttrsListBean();
                    att.setSku("0");
                    unit = datum.getUnit();
                    att.setName(datum.getName());
                    if (datum.getChildren() != null && datum.getChildren().size() > 0) {
                        List<GoodsDetailBean> skuList = new ArrayList<>();
                        for (FilterEntity child : datum.getChildren()) {
                            skuList.add(new GoodsDetailBean( child.getAttributeNo(),child.getStartVal()+unit));
                        }
                        att.setGoodsDetailBeans(skuList);
                    }
                    attrsList.add(att);
                }
                ShoplistBean addshoplist = new ShoplistBean();
                addshoplist.setAttrs(attrsList);
                addshoplist.setIndex(adapter.getDatas().size() + 1);
                addshoplist.setFirstType(bean.getFirstType());
                addshoplist.setFirstTypeName(bean.getFirstTypeName());
                addshoplist.setSecondType(bean.getSecondType());
                addshoplist.setSecondTypeName(bean.getSecondTypeName());
                addshoplist.setThirdType(bean.getThirdType());
                addshoplist.setThirdTypeName(bean.getThirdTypeName());
                addshoplist.setUnitName(bean.getUnitName());
                addshoplist.setNum("");
                addshoplist.setRangeBrands("");
                addshoplist.setStartTime(bean.getDeadline());
                addshoplist.setExitTime("");
                addshoplist.setEntranceTime("");
                addshoplist.setPickTime("");
                addshoplist.setGoodsMaterial("");//商品材料
                addshoplist.setGoodsQuality("");//质量标准
                addshoplist.setGoodsMaintenance("");//维修保养
                addshoplist.setGoodsPurpose("");//商品用途
                addshoplist.setGoodsDescribe("");//特征描述
                addshoplist.setGroupbuyClass(bean.getGroupbuyClass());
                shoplist.add(addshoplist);
            } else {
                ShoplistBean addshoplist = new ShoplistBean();
                addshoplist.setAttrs(new ArrayList<>());
                addshoplist.setIndex(adapter.getDatas().size() + 1);
                addshoplist.setFirstType(bean.getFirstType());
                addshoplist.setFirstTypeName(bean.getFirstTypeName());
                addshoplist.setSecondType(bean.getSecondType());
                addshoplist.setSecondTypeName(bean.getSecondTypeName());
                addshoplist.setThirdType(bean.getThirdType());
                addshoplist.setThirdTypeName(bean.getThirdTypeName());
                addshoplist.setUnitName(bean.getUnitName());
                addshoplist.setNum("");
                addshoplist.setStartTime(bean.getDeadline());
                addshoplist.setRangeBrands("");
                addshoplist.setExitTime("");
                addshoplist.setEntranceTime("");
                addshoplist.setPickTime("");
                addshoplist.setGoodsMaterial("");//商品材料
                addshoplist.setGoodsQuality("");//质量标准
                addshoplist.setGoodsMaintenance("");//维修保养
                addshoplist.setGoodsPurpose("");//商品用途
                addshoplist.setGoodsDescribe("");//特征描述
                addshoplist.setGroupbuyClass(bean.getGroupbuyClass());
                shoplist.add(addshoplist);
            }
            adapter.setDatas(shoplist);
            adapter.notifyDataSetChanged();
        }
    }

    @Override
    public void OnWholeItemClick(View view) {
        int id = view.getId();//收货地址
//交流信息接收人
//通知人员
        if (id == R.id.publish_units) {//发起单位
            if (companyList == null) {
                viewModel.getCompanyList(view, true);
            } else {
                showListPop("发起单位", view, companyList);
            }
        } else if (id == R.id.start_department) {//发起部门
            viewModel.getDepartmentList(bean.getPickCompanyId(), view);
        } else if (id == R.id.shipping_address || id == R.id.jicai_scope) {//集采范围
            if (addressEntityList == null) {
                viewModel.getAddressList(view);
            } else {
                showCityPop("选择城市", view);
            }
        } else if (id == R.id.jicai_type) {//集采类型
            if (jicaiTypeList == null) {
                viewModel.getJiCaiTypeList(view);
            } else {
                showListPop("选择集采类型", view, jicaiTypeList);
            }
        } else if (id == R.id.communication_receive_name || id == R.id.letter_receive_name) {//函询接收人
            if (UserList == null) {
                viewModel.getUserList(view, true);
            } else {
                showListPop("选择接收人", view, UserList);
            }
        } else if (id == R.id.supervise_receive_name) {//监督接收人
            if (UserList == null) {
                viewModel.getUserList(view, true);
            } else {
                showListPop("选择监督人", view, UserList);
            }
        } else if (id == R.id.deadline) {//集采截止时间
            showTimePop();
        } else if (id == R.id.payment_type) {//付款方式
            if (paymentList == null) {
                viewModel.getPaymentType(view);
            } else {
                showListPop("选择付款方式", view, paymentList);
            }
        } else if (id == R.id.supplier_require) {//供方要求
            if (supplierRequireList == null) {
                viewModel.getSupplierRequireList(view);
            } else {
                showListPop("选择供方要求", view, supplierRequireList);
            }
        } else if (id == R.id.registered_fund) {//注册资金
            if (registeredFundList == null) {
                viewModel.getRegisteredFundList(view);
            } else {
                showListPop("选择注册资金", view, registeredFundList);
            }
        } else if (id == R.id.operation_result) {//经营业绩
            if (operationResultList == null) {
                viewModel.getOperationResultList(view);
            } else {
                showListPop("选择经营业绩", view, operationResultList);
            }
        } else if (id == R.id.inventory_requirements) {//存货要求
            if (inventoryRequirementsList == null) {
                viewModel.getInventoryRequirementsList(view);
            } else {
                showListPop("选择存货要求", view, inventoryRequirementsList);
            }
        } else if (id == R.id.profession_require) {//专业要求
            if (professionRequireList == null) {
                viewModel.getProfessionRequireList(view);
            } else {
                showListPop("选择专业要求", view, professionRequireList);
            }
        } else if (id == R.id.invoice_type) {//发票类型
            if (invoiceList == null) {
                viewModel.getInvoiceType(view);
            } else {
                showListPop("选择发票类型", view, invoiceList);
            }
        } else if (id == R.id.tax_rate) {//税率
            if (taxRateList == null) {
                viewModel.getTaxRate(view);
            } else {
                showListPop("选择税率", view, taxRateList);
            }
        } else if (id == R.id.goods_type) {//商品类型
            switch (bean.getGroupbuyClass()) {
                case "1"://商品材料
                    if (goodsTypeEntityList != null) {
                        showGoodsTypePop();
                    } else {
                        viewModel.getGoodsCategory();
                    }
                    //选择完成后调用sku接口获取属性信息
                    break;
                case "2"://机械租赁
                    if (publicTypeEntityList != null) {
                        startActivityForResult(new Intent(getApplicationContext(), JiCaiDeviceTypeActivity.class).putExtra("publicTypeEntityList", (Serializable) publicTypeEntityList),100101);
                    } else {
                        viewModel.getMachineTypeModel();
                    }
                    break;
                case "3"://设备租赁
                    if (equipmentList != null) {
                        startActivityForResult(new Intent(getApplicationContext(), JiCaiDeviceTypeActivity.class).putExtra("publicTypeEntityList", (Serializable) equipmentList),100202);
                    } else {
                        viewModel.getParentDeviceType();
                    }
                    break;
            }
        } else if (id == R.id.unit_measure) {//计量单位
            if (unitList == null) {
                viewModel.getUnitList(view);
            } else {
                showListPop("选择计量单位", view, unitList);
            }
        } else if (id == R.id.faction_user || id == R.id.count_user) {//通知人员
            if (UserList == null) {
                viewModel.getUserList(view, true);
            } else {
                showListPop("选择通知人员", view, UserList);
            }
        } else if (id == R.id.charge_way) {//收取方式
            if (chargeWayList == null) {
                viewModel.getChargeWayList(view);
            } else {
                showListPop("收取方式", view, chargeWayList);
            }
        } else if (id == R.id.shipping_method) {//送货方式
            if (shippingMethodList == null) {
                viewModel.getShippingMethodList(view);
            } else {
                showListPop("送货方式", view, shippingMethodList);
            }
        }
    }

    /**
     * 基础信息模块view初始化
     */
    private void basicsView() {
        for (int i = 0; i < superviseListTitle.length; i++) {
            //监督信息接收人信息
            SuperviseListBean bean = new SuperviseListBean();
            bean.setAccusationItem(i + 1 + "");
            bean.setName(superviseListTitle[i]);
            this.superviseList.add(bean);
        }
        superviseadapter = new SuperviseAdapter(this, superviseList);
        binding.demanderBasics.basic.superviseList.setLayoutManager(new LinearLayoutManager(getActivity()));
        binding.demanderBasics.basic.superviseList.setAdapter(superviseadapter);
        superviseadapter.setOnItemClick(new AdapterOnItemClick<SuperviseListBean>() {
            @Override
            public void onItemClick(SuperviseListBean bean, int position) {
                //选择框调用
                if (UserList == null) {
                    viewModel.getUserList(new View(getApplicationContext()), false);
                }
                if (UserList != null && UserList.size() > 0) {
                    showSuperviseListPop("选择接收人", bean, UserList);
                }
            }
        });
    }

    /**
     * 基础信息下一步数据效验
     */
    private void oneNextStepData() {
        if (TextUtils.isEmpty(binding.demanderBasics.basic.contactName.getContent())) {
            MToast.showToast(this, "请输入联系人姓名");
            return;
        } else {
            bean.setContacts(binding.demanderBasics.basic.contactName.getContent());
        }
        if (TextUtils.isEmpty(binding.demanderBasics.basic.contact.getContent())) {
            MToast.showToast(this, "请输入联系方式");
            return;
        } else if (!CheckUtils.isPhoneNumberValid(binding.demanderBasics.basic.contact.getContent())) {
            MToast.showToast(this, "请输入正确格式的联系方式");
            return;
        } else {
            bean.setContactNumber(binding.demanderBasics.basic.contact.getContent());
        }
        if (TextUtils.isEmpty(binding.demanderBasics.basic.shippingAddress.getContent())) {
            MToast.showToast(this, "请选择收货地址");
            return;
        }
        if (TextUtils.isEmpty(binding.demanderBasics.basic.address.getEditContent())) {
            MToast.showToast(this, "请填写详细收货地址");
            return;
        } else {
            bean.setReceiptAddress(binding.demanderBasics.basic.address.getEditContent());
        }
        if (TextUtils.isEmpty(binding.demanderBasics.basic.jicaiScope.getContent())) {
            MToast.showToast(this, "请选择集采范围");
            return;
        }
        if (TextUtils.isEmpty(binding.demanderBasics.basic.principal.getContent())) {
            MToast.showToast(this, "请输入负责人姓名");
            return;
        } else {
            bean.setDirector(binding.demanderBasics.basic.principal.getContent());
        }
        if (TextUtils.isEmpty(binding.demanderBasics.basic.contactMethod.getContent())) {
            MToast.showToast(this, "请输入负责人联系方式");
            return;
        } else if (!CheckUtils.isPhoneNumberValid(binding.demanderBasics.basic.contactMethod.getContent())) {
            MToast.showToast(this, "请输入正确格式的负责人联系方式");
            return;
        } else {
            bean.setDirectorNumber(binding.demanderBasics.basic.contactMethod.getContent());
        }
        if (TextUtils.isEmpty(binding.demanderBasics.basic.communicationReceiveName.getContent())) {
            MToast.showToast(this, "请选择交流信息接收人");
            return;
        }
        //按照类型设置监督人
        if (TextUtils.equals(bean.getSuperviseType(), "2")) {
            if (superviseadapter != null && superviseadapter.getDatas().size() > 0) {
                bean.setSuperviseList(superviseadapter.getDatas());
                for (SuperviseListBean superviseListBean : bean.getSuperviseList()) {
                    if (TextUtils.isEmpty(superviseListBean.getSuperviseUserName())) {
                        MToast.showToast(this, "请选择" + superviseListBean.getName() + "监督人");
                        return;
                    }
                }
            }
        } else {
            if (TextUtils.isEmpty(binding.demanderBasics.basic.superviseReceiveName.getContent())) {
                MToast.showToast(this, "请选择监督接收人");
                return;
            }
        }
        //基础自定义字段
        List<JiCaiCustomFieldBean> customFieldViewData = binding.demanderBasics.basic.basicCustomField.getCustomFieldViewData();
        List<BaseAddFiledBean> BaseAddFiled = new ArrayList<>();
        if (customFieldViewData != null && customFieldViewData.size() > 0) {
            for (JiCaiCustomFieldBean viewDatum : customFieldViewData) {
                if (TextUtils.isEmpty(viewDatum.getKey())) {
                    MToast.showToast(this, "请完善基础信息自定义字段");
                    return;
                }
                if (TextUtils.isEmpty(viewDatum.getVal())) {
                    MToast.showToast(this, "请完善基础信息自定义字段");
                    return;
                }
                BaseAddFiled.add(new BaseAddFiledBean(viewDatum.getKey() + "", viewDatum.getVal() + ""));
            }
        }
        bean.setBaseAddFiled(BaseAddFiled);
        if (TextUtils.equals(bean.getGroupBuyType(), "2")) {
            if (TextUtils.isEmpty(binding.demanderBasics.jicai.deadline.getContent())) {
                MToast.showToast(this, "请选择集采截止时间");
                return;
            }
        }
        if (TextUtils.isEmpty(binding.demanderBasics.join.initialEnergy.getContent())) {
            MToast.showToast(this, "请输入采购起始数量");
            return;
        } else {
            bean.setLowBuy(binding.demanderBasics.join.initialEnergy.getContent());
        }
        if (TextUtils.isEmpty(binding.demanderBasics.join.depositRate.getContent())) {
            MToast.showToast(this, "请输入定金比例");
            return;
        } else {
            bean.setDepositRatio(binding.demanderBasics.join.depositRate.getContent());
        }
        if (TextUtils.isEmpty(binding.demanderBasics.join.paymentType.getContent())) {
            MToast.showToast(this, "请选择付款方式");
            return;
        }
        //付款方式 (1 预付款  2货到付款  3其他)
        if (TextUtils.equals(bean.getPayType(), "1")) {
            if (TextUtils.isEmpty(binding.demanderBasics.join.paymentRatio.getText().toString().trim())) {
                MToast.showToast(this, "请填写付款比例");
                return;
            } else {
                bean.setPayRatio(binding.demanderBasics.join.paymentRatio.getText().toString().trim());
            }
            if (TextUtils.isEmpty(binding.demanderBasics.join.paymentPeriod.getText().toString().trim())) {
                MToast.showToast(this, "请填写尾款支付周期");
                return;
            } else {
                bean.setFinalPaymentTime(binding.demanderBasics.join.paymentPeriod.getText().toString().trim());
            }
        }
        if (TextUtils.equals(bean.getPayType(), "3")) {
            if (TextUtils.isEmpty(binding.demanderBasics.join.elsePaymentType.getContent())) {
                MToast.showToast(this, "请填写其他付款方式");
                return;
            } else {
                bean.setOtherPayType(binding.demanderBasics.join.elsePaymentType.getContent());
            }
        }
        //加盟方需求自定义字段
        List<JiCaiCustomFieldBean> customFieldViewData1 = binding.demanderBasics.join.joinCustomField.getCustomFieldViewData();
        List<JoinRequireCustomizeFieldsBean> FiledBase = new ArrayList<>();
        if (customFieldViewData1 != null && customFieldViewData1.size() > 0) {
            for (JiCaiCustomFieldBean fieldBean : customFieldViewData1) {
                if (TextUtils.isEmpty(fieldBean.getKey())) {
                    MToast.showToast(this, "请完善加盟方需求自定义字段");
                    return;
                }
                if (TextUtils.isEmpty(fieldBean.getVal())) {
                    MToast.showToast(this, "请完善加盟方需求自定义字段");
                    return;
                }
                FiledBase.add(new JoinRequireCustomizeFieldsBean(fieldBean.getKey() + "", fieldBean.getVal() + ""));
            }
        }
        bean.setJoinRequireCustomizeFields(FiledBase);
        if (TextUtils.isEmpty(binding.demanderBasics.offer.depositRate.getText().toString().trim())) {
            MToast.showToast(this, "请填写质保金");
            return;
        } else {
            bean.setQuailtyNum(binding.demanderBasics.offer.depositRate.getText().toString().trim());
        }
        if (TextUtils.equals(bean.getGroupbuyClass(), "1")) {
            if (TextUtils.isEmpty(binding.demanderBasics.offer.guaranteeTime.getText().toString().trim())) {
                MToast.showToast(this, "请填写质保周期");
                return;
            } else {
                bean.setQuailtyCycle(binding.demanderBasics.offer.guaranteeTime.getText().toString().trim());
            }
        }
        if (TextUtils.isEmpty(binding.demanderBasics.offer.invoiceType.getContent())) {
            MToast.showToast(this, "请选择发票类型");
            return;
        }
        if (TextUtils.equals(bean.getBillType(), "2")) {
            if (TextUtils.isEmpty(binding.demanderBasics.offer.taxRate.getContent())) {
                MToast.showToast(this, "请选择税率");
                return;
            }
        }
        //报价方要求自定义字段
        List<JiCaiCustomFieldBean> fieldViewData = binding.demanderBasics.offer.offerCustomField.getCustomFieldViewData();
        List<CommodityUseAddFiledBean> beanList = new ArrayList<>();
        for (JiCaiCustomFieldBean fieldViewDatum : fieldViewData) {
            if (TextUtils.isEmpty(fieldViewDatum.getKey())) {
                MToast.showToast(this, "请完善报价方要求自定义字段");
                return;
            }
            if (TextUtils.isEmpty(fieldViewDatum.getVal())) {
                MToast.showToast(this, "请完善报价方要求自定义字段");
                return;
            }
            beanList.add(new CommodityUseAddFiledBean(fieldViewDatum.getKey() + "", fieldViewDatum.getVal() + ""));
        }
        bean.setCustomizeOrderFields(beanList);
        binding.demanderBasics.getRoot().setVisibility(View.GONE);
        binding.demanderList.getRoot().setVisibility(View.VISIBLE);
        binding.demanderRule.getRoot().setVisibility(View.GONE);
        binding.demanderContentProgress.setProgressbar(75);
        //集采方式改变，清单列表跟随修改
        if (shoplist!=null&&shoplist.size()>0){
            for (ShoplistBean shoplistBean : shoplist) {
                if (TextUtils.isEmpty(bean.getDeadline())){
                    shoplistBean.setStartTime("");
                }else {
                    shoplistBean.setStartTime(bean.getDeadline()+"");
                }
            }
        }
        binding.scrollview.scrollTo(0,0);
    }

    /**
     * 集采清单下一步
     */
    private void TwoNextStepData() {
        if (TextUtils.isEmpty(binding.demanderList.goodsType.getContent())) {
            switch (bean.getGroupbuyClass()) {
                case "1":
                    MToast.showToast(this, "请选择商品类型");
                    break;
                case "2":
                    MToast.showToast(this, "请选择机械类型");
                    break;
                case "3":
                    MToast.showToast(this, "请选择设备类型");
                    break;
            }
            return;
        }
        if (TextUtils.isEmpty(binding.demanderList.unitMeasure.getContent())) {
            MToast.showToast(this, "请选择计量单位");
            return;
        }
        List<String> linkedHashSet = new ArrayList<>();
        List<ShoplistBean> datas = adapter.getDatas();
        for (ShoplistBean data : datas) {
            data.setUnitName(bean.getUnitName());
            data.setUnit(bean.getUnit());
            if (TextUtils.isEmpty(data.getNum())) {
                MToast.showToast(this, "请完善清单中采购量");
                return;
            }
            if (TextUtils.equals(data.getGroupbuyClass(), "1")) {
                if (TextUtils.isEmpty(data.getPickTime())) {
                    MToast.showToast(this, "请完善清单中提货时间");
                    return;
                }
                if (TextUtils.equals(bean.getGroupBuyType(),"2")){
                      if (Long.valueOf(bean.getDeadline())>=Long.valueOf(data.getPickTime())){
                          MToast.showToast(this, "请重新选择提货时间");
                          return;
                      }
                }
            } else {
                if (TextUtils.isEmpty(data.getEntranceTime())) {
                    MToast.showToast(this, "请完善清单中进场时间");
                    return;
                }
                if (TextUtils.equals(bean.getGroupBuyType(),"2")){
                    if (Long.valueOf(bean.getDeadline())>=Long.valueOf(data.getEntranceTime())){
                        MToast.showToast(this, "请重新选择进场时间");
                        return;
                    }
                }
                if (TextUtils.isEmpty(data.getExitTime())) {
                    MToast.showToast(this, "请完善清单中结束时间");
                    return;
                }
            }
            List<AttrsListBean> attrs = data.getAttrs();
            StringBuilder result = new StringBuilder();
            for (int j = 0; j < attrs.size(); j++) {
                result.append(attrs.get(j).getName()).append(":").append(attrs.get(j).getVal()).append(",");
            }
            if (linkedHashSet.contains(result.toString())) {
                MToast.showToast(this, "相同属性不能添加");
                return;
            }
            linkedHashSet.add(result.toString());
        }
        bean.setShoplist(datas);
        binding.demanderBasics.getRoot().setVisibility(View.GONE);
        binding.demanderList.getRoot().setVisibility(View.GONE);
        binding.demanderRule.getRoot().setVisibility(View.VISIBLE);
        binding.demanderContentProgress.setProgressbar(100);
        binding.scrollview.scrollTo(0,0);
    }

    /**
     * 提交
     */
    private void submitData() {
        //加盟/报价通知
        List<PushRulesBean> mqPushRules = new ArrayList<>();
        if (binding.demanderRule.offer.cbFactionDays.isChecked() || binding.demanderRule.offer.cbFactionWeek.isChecked() || !TextUtils.isEmpty(binding.demanderRule.offer.joinNumHome.getText().toString().trim()) || !TextUtils.isEmpty(binding.demanderRule.offer.joinNumOrder.getText().toString().trim()) || !TextUtils.isEmpty(binding.demanderRule.offer.factionUser.getContent())) {
            if (!binding.demanderRule.offer.cbFactionDays.isChecked() && !binding.demanderRule.offer.cbFactionWeek.isChecked()) {
                MToast.showToast(this, "请选择加盟通知频率");
                return;
            }
            if (TextUtils.isEmpty(binding.demanderRule.offer.joinNumHome.getText().toString().trim())) {
                MToast.showToast(this, "请输入加盟家数低于");
                return;
            } else {
                joinpush.setLowJoinCount(binding.demanderRule.offer.joinNumHome.getText().toString().trim());//加盟最低家数
            }
            if (TextUtils.isEmpty(binding.demanderRule.offer.joinNumOrder.getText().toString().trim())) {
                MToast.showToast(this, "请输入加盟次数低于");
                return;
            } else {
                joinpush.setLowJoinTimes(binding.demanderRule.offer.joinNumOrder.getText().toString().trim());//加盟最低次数
            }
            if (TextUtils.isEmpty(binding.demanderRule.offer.factionUser.getContent())) {
                MToast.showToast(this, "请选择加盟通知人员");
                return;
            }
            if (joinpush != null) {
                mqPushRules.add(joinpush);
            }
        }
        if (binding.demanderRule.offer.cbCountDays.isChecked() || binding.demanderRule.offer.cbCountWeek.isChecked() || !TextUtils.isEmpty(binding.demanderRule.offer.offerNumHome.getText().toString().trim()) || !TextUtils.isEmpty(binding.demanderRule.offer.offerNumOrder.getText().toString().trim()) || !TextUtils.isEmpty(binding.demanderRule.offer.countUser.getContent())) {
            if (!binding.demanderRule.offer.cbCountDays.isChecked() && !binding.demanderRule.offer.cbCountWeek.isChecked()) {
                MToast.showToast(this, "请选择报价通知频率");
                return;
            }
            if (TextUtils.isEmpty(binding.demanderRule.offer.offerNumHome.getText().toString().trim())) {
                MToast.showToast(this, "请输入报价家数低于");
                return;
            } else {
                offerpush.setLowOfferCount(binding.demanderRule.offer.offerNumHome.getText().toString().trim());//报价最低家数
            }
            if (TextUtils.isEmpty(binding.demanderRule.offer.offerNumOrder.getText().toString().trim())) {
                MToast.showToast(this, "请输入报价次数低于");
                return;
            } else {
                offerpush.setLowOfferTimes(binding.demanderRule.offer.offerNumOrder.getText().toString().trim());//报价最低次数
            }
            if (TextUtils.isEmpty(binding.demanderRule.offer.countUser.getContent())) {
                MToast.showToast(this, "请选择报价通知人员");
                return;
            }
            if (offerpush != null) {
                mqPushRules.add(offerpush);
            }
        }
        dtoBean.setMqPushRules(mqPushRules);
        //服务费收取
        if (TextUtils.isEmpty(binding.demanderRule.serviceCharge.chargeWay.getContent())) {
            MToast.showToast(this, "请选择服务费收取方式");
            return;
        }
        switch (dtoBean.getStandardOfServiceCharges()) {
            case "1"://按照成交额比例收取
                if (TextUtils.isEmpty(binding.demanderRule.serviceCharge.costRatio.getText().toString().trim())) {
                    MToast.showToast(this, "请输入收取比例");
                    return;
                } else {
                    dtoBean.setStandardOfServiceRatio(binding.demanderRule.serviceCharge.costRatio.getText().toString().trim());
                }
                break;
            case "2"://按照每单固定收费
                if (TextUtils.isEmpty(binding.demanderRule.serviceCharge.money.getText().toString().trim())) {
                    MToast.showToast(this, "请输入费用");
                    return;
                } else {
                    dtoBean.setStandardOfServiceCost(binding.demanderRule.serviceCharge.money.getText().toString().trim());
                }
                break;
        }
        //送货方式
        if (TextUtils.isEmpty(binding.demanderRule.delivery.shippingMethod.getContent())) {
            MToast.showToast(this, "请选择送货方式");
            return;
        }
        switch (dtoBean.getDeliveryMethod()) {
            case "1"://需方自提
                break;
            case "2"://供方配送gratis_distance
                if (TextUtils.isEmpty(binding.demanderRule.delivery.gratisDistance.getText().toString().trim())) {
                    MToast.showToast(this, "请输入免费配送距离");
                    return;
                } else {
                    dtoBean.setFreeKil(binding.demanderRule.delivery.gratisDistance.getText().toString().trim());
                }
                if (TextUtils.isEmpty(binding.demanderRule.delivery.chargeDistance.getText().toString().trim())) {
                    MToast.showToast(this, "请输入超出收费标准距离");
                    return;
                } else {//extraRates
                    dtoBean.setExtraRates(binding.demanderRule.delivery.chargeDistance.getText().toString().trim());
                }
                if (TextUtils.isEmpty(binding.demanderRule.delivery.chargeCost.getText().toString().trim())) {
                    MToast.showToast(this, "请输入超出收费标准费用");
                    return;
                } else {
                    dtoBean.setExtraRatesCost(binding.demanderRule.delivery.chargeCost.getText().toString().trim());
                }
                break;
            case "3"://发送方配送
                List<FreightRulesBean> datas = methodadapter.getDatas();
                for (FreightRulesBean data : datas) {
                    if (TextUtils.isEmpty(data.getKilometers())) {
                        MToast.showToast(this, "请输入发送方配送公里数");
                        return;
                    }
                    if (TextUtils.isEmpty(data.getFreight())) {
                        MToast.showToast(this, "请输入发送方配送费用");
                        return;
                    }
                }
                dtoBean.setFreightRules(methodadapter.getDatas());
                break;
        }
        //其他信息
        //质量要求
        dtoBean.setQualityRequirement(binding.demanderRule.delivery.qualityRequirement.getEditText() + "");
        //退货要求
        dtoBean.setReturnRequirement(binding.demanderRule.delivery.refundRequest.getEditText() + "");
        //安装要求
        dtoBean.setInstallationRequirement(binding.demanderRule.delivery.normal.getEditText() + "");
        //质保约定
        dtoBean.setWarrantyRequirement(binding.demanderRule.delivery.qualityGuarantee.getEditText() + "");
        //维修约定
        dtoBean.setRepairRequirement(binding.demanderRule.delivery.maintenanceContract.getEditText() + "");
        //付款约定
        dtoBean.setPaymentRequirement(binding.demanderRule.delivery.paymentAgreement.getEditText() + "");
        //物流约定
        dtoBean.setLogisticsRequirement(binding.demanderRule.delivery.logisticsContract.getEditText() + "");
        //集采规则自定义字段
        List<JiCaiCustomFieldBean> customFieldViewData = binding.demanderRule.delivery.ruleCustomField.getCustomFieldViewData();
        List<GroupbuyingRuleCustomizeFieldsBean> BaseAddFiled = new ArrayList<>();
        if (customFieldViewData != null && customFieldViewData.size() > 0) {
            for (JiCaiCustomFieldBean viewDatum : customFieldViewData) {
                if (TextUtils.isEmpty(viewDatum.getKey())) {
                    MToast.showToast(this, "请完善基础信息自定义字段");
                    return;
                }
                if (TextUtils.isEmpty(viewDatum.getVal())) {
                    MToast.showToast(this, "请完善基础信息自定义字段");
                    return;
                }
                BaseAddFiled.add(new GroupbuyingRuleCustomizeFieldsBean(viewDatum.getKey() + "", viewDatum.getVal() + ""));
            }
        }
        dtoBean.setGroupbuyingRuleCustomizeFields(BaseAddFiled);
        //设置集采规则
        bean.setGroupbuyingRuleDTO(dtoBean);
        viewModel.setJiCaiDemanderPublish(bean);
    }

    /**
     * 用户列表信息
     *
     * @param data
     * @param isboole
     */
    public void setUserList(List<JiCaiPublishListBean> data, View view, boolean isboole) {
        this.UserList = data;
        if (isboole) {
            showListPop("选择接收人", view, UserList);
        } else {
            for (JiCaiPublishListBean jiCaiPublishListBean : data) {
                if (jiCaiPublishListBean.getName().equals(userName)) {
                    //交流信息接收人
                    bean.setCustomerServiceContactsId(jiCaiPublishListBean.getId());
                    //函询接收人
                    bean.setInquiryUserMemberNo(jiCaiPublishListBean.getNo() + "");
                    //监督接收人
                    SuperviseListBean lisbean = new SuperviseListBean();
                    lisbean.setSuperviseUserName(userName + "");
                    lisbean.setSuperviseUserMemberNo(jiCaiPublishListBean.getNo() + "");
                    lisbean.setAccusationItem("0");
                    List<SuperviseListBean> superviseList = new ArrayList<>();
                    superviseList.add(lisbean);
                    bean.setSuperviseList(superviseList);
                }
            }
        }
    }

    /**
     * 集采时间选择
     */
    private void showTimePop() {
        Calendar dayCalendar = Calendar.getInstance();
        dayCalendar.add(Calendar.DAY_OF_MONTH, 1);
        TimePickerView timePicker = new TimePickerBuilder(this, (date, v) -> {
            @SuppressLint("SimpleDateFormat") SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String format = sdf.format(date);
            binding.demanderBasics.jicai.deadline.setContent(format);
            bean.setDeadline(String.valueOf(DateUtils.dateTo13Timestamp(format)));
        }).setType(new boolean[]{true, true, true, false, false, false})
                .setCancelText("取消").setSubCalSize(15)
                .setCancelColor(Color.parseColor("#666666"))
                .setTitleText("请选择时间")
                .setTitleColor(Color.parseColor("#969696")).setTitleSize(15)
                .setSubmitText("确定")
                .setSubmitColor(Color.parseColor("#5792FD"))
                .setRangDate(dayCalendar, null)
                .build();
        timePicker.show();
    }

    /**
     * 一级选择弹窗
     *
     * @param titles
     * @param inputTextView
     * @param data
     */
    private void showListPop(String titles, View inputTextView, List<JiCaiPublishListBean> data) {
        if (data != null && data.size() > 0) {
            OptionsPickerView<JiCaiPublishListBean> mCustomerOptions = new OptionsPickerBuilder(this, new OnOptionsSelectListener() {
                @Override
                public void onOptionsSelect(int options1, int options2, int options3, View v) {
                    int id = inputTextView.getId();
                    if (id == R.id.publish_units) {//发起单位
                        binding.demanderBasics.basic.publishUnits.setContent(data.get(options1).getName() + "");
                        bean.setPickCompanyId(data.get(options1).getId() + "");
                        bean.setPickCompanyName(data.get(options1).getName() + "");
                        binding.demanderBasics.basic.startDepartment.setContent("");
                        bean.setCreateCompnyDepartmentNo("");
                        bean.setCreateCompnyDepartment("");
                    } else if (id == R.id.start_department) {//发起部门
                        binding.demanderBasics.basic.startDepartment.setContent(data.get(options1).getName() + "");
                        bean.setCreateCompnyDepartmentNo(data.get(options1).getId() + "");
                        bean.setCreateCompnyDepartment(data.get(options1).getName() + "");
                    } else if (id == R.id.jicai_type) {//集采类型
                        binding.demanderBasics.basic.jicaiType.setContent(data.get(options1).getName() + "");
                        bean.setGroupbuyClass(data.get(options1).getNo() + "");
                        switch (data.get(options1).getName()) {
                            case "商品材料":
                                binding.demanderList.goodsType.setHint("请选择商品类型");
                                binding.demanderList.goodsType.setLabelName("商品类型");
                                binding.demanderBasics.offer.llQaPeriod.setVisibility(View.VISIBLE);
                                binding.demanderBasics.offer.llDriver.setVisibility(View.GONE);
                                bean.setOfferOperator("");//是否需要驾驶员 0否 1是
                                break;
                            case "机械租赁":
                                binding.demanderList.goodsType.setHint("请选择机械类型");
                                binding.demanderList.goodsType.setLabelName("机械类型");
                                binding.demanderBasics.offer.llQaPeriod.setVisibility(View.GONE);
                                binding.demanderBasics.offer.llDriver.setVisibility(View.VISIBLE);
                                binding.demanderBasics.offer.driverName.setText("是否带驾驶员");
                                bean.setOfferOperator("1");//是否需要驾驶员 0否 1是
                                break;
                            case "设备租赁":
                                binding.demanderList.goodsType.setHint("请选择设备类型");
                                binding.demanderList.goodsType.setLabelName("设备类型");
                                binding.demanderBasics.offer.llQaPeriod.setVisibility(View.GONE);
                                binding.demanderBasics.offer.llDriver.setVisibility(View.VISIBLE);
                                binding.demanderBasics.offer.driverName.setText("是否带操作员");
                                bean.setOfferOperator("1");//是否带操作员 0否 1是
                                break;
                        }
                        bean.setQuailtyType("");
                        binding.demanderList.goodsType.setContent("");
                        binding.demanderList.unitMeasure.setContent("");
                        bean.setUnitName("");
                        bean.setUnit("");
                        bean.setQuailtyCycle("");
                        bean.setQuailtyCycleUnit("");
                        adapterView(data.get(options1).getNo() + "");//初始化集采清单初始化
                    } else if (id == R.id.communication_receive_name) {//交流信息接收人
                        binding.demanderBasics.basic.communicationReceiveName.setContent(data.get(options1).getName() + "");
                        bean.setCustomerServiceContactsId(data.get(options1).getId());
                    } else if (id == R.id.letter_receive_name) {//函询接收人
                        binding.demanderBasics.basic.letterReceiveName.setContent(data.get(options1).getName() + "");
                        bean.setInquiryUserName(data.get(options1).getName() + "");
                        bean.setInquiryUserMemberNo(data.get(options1).getNo() + "");
                    } else if (id == R.id.supervise_receive_name) {//监督接收人
                        binding.demanderBasics.basic.superviseReceiveName.setContent(data.get(options1).getName() + "");
                        SuperviseListBean lisbean = new SuperviseListBean();
                        lisbean.setSuperviseUserName(data.get(options1).getName() + "");
                        lisbean.setSuperviseUserMemberNo(data.get(options1).getNo() + "");
                        lisbean.setAccusationItem("0");
                        List<SuperviseListBean> superviseList = new ArrayList<>();
                        superviseList.add(lisbean);
                        bean.setSuperviseList(superviseList);
                    } else if (id == R.id.payment_type) {//付款方式
                        binding.demanderBasics.join.paymentType.setContent(data.get(options1).getName() + "");
                        bean.setPayType(data.get(options1).getId());
                        switch (data.get(options1).getId()) {
                            case "1"://预付款
                                binding.demanderBasics.join.llPlanPayment.setVisibility(View.VISIBLE);
                                binding.demanderBasics.join.elsePaymentType.setVisibility(View.GONE);
                                break;
                            case "2"://货到付款
                                binding.demanderBasics.join.llPlanPayment.setVisibility(View.GONE);
                                binding.demanderBasics.join.elsePaymentType.setVisibility(View.GONE);
                                break;
                            case "3"://其他
                                binding.demanderBasics.join.llPlanPayment.setVisibility(View.GONE);
                                binding.demanderBasics.join.elsePaymentType.setVisibility(View.VISIBLE);
                                break;
                        }
                    } else if (id == R.id.supplier_require) {//供方要求
                        binding.demanderBasics.offer.supplierRequire.setContent(data.get(options1).getName() + "");
                        bean.setManufactorCredentials(binding.demanderBasics.offer.supplierRequire.getContent() + "");
                    } else if (id == R.id.registered_fund) {//注册资金
                        binding.demanderBasics.offer.registeredFund.setContent(data.get(options1).getName() + "");
                        bean.setRegisteredCapital(binding.demanderBasics.offer.registeredFund.getContent() + "");
                    } else if (id == R.id.operation_result) {//经营业绩
                        binding.demanderBasics.offer.operationResult.setContent(data.get(options1).getName() + "");
                        bean.setOperatingPerformance(binding.demanderBasics.offer.operationResult.getContent() + "");
                    } else if (id == R.id.inventory_requirements) {//存货要求
                        binding.demanderBasics.offer.inventoryRequirements.setContent(data.get(options1).getName() + "");
                        bean.setInventoryRequirements(binding.demanderBasics.offer.inventoryRequirements.getContent() + "");
                    } else if (id == R.id.profession_require) {//专业要求
                        binding.demanderBasics.offer.professionRequire.setContent(data.get(options1).getName() + "");
                        bean.setMajorCredentials(binding.demanderBasics.offer.professionRequire.getContent() + "");
                    } else if (id == R.id.ll_deposit_rate_unit) {//质保金单位
                        binding.demanderBasics.offer.depositRate.setText("");
                        binding.demanderBasics.offer.tvDepositRateUnit.setText(data.get(options1).getName());
                        binding.demanderBasics.offer.depositRate.setHint(data.get(options1).getId() + "");
                        bean.setQuailtyType(data.get(options1).getNo());
                        switch (data.get(options1).getNo()) {
                            case "1":
                                binding.demanderBasics.offer.depositRate.setFilters(new InputFilter[]{new InputFilter.LengthFilter(9)});
                                break;
                            case "2":
                                binding.demanderBasics.offer.depositRate.setFilters(new InputFilter[]{new InputFilter.LengthFilter(2)});
                                break;
                        }
                    } else if (id == R.id.ll_time_unit) {//质保周期
                        binding.demanderBasics.offer.tvTimeUnit.setText(data.get(options1).getName());
                        bean.setQuailtyCycleUnit(data.get(options1).getName());
                        binding.demanderBasics.offer.tvPeriod.setText(data.get(options1).getName());
                    } else if (id == R.id.invoice_type) {//发票类型
                        binding.demanderBasics.offer.invoiceType.setContent(data.get(options1).getName() + "");
                        bean.setBillType(data.get(options1).getId());
                        if (data.get(options1).getId().equals("2")) {
                            binding.demanderBasics.offer.taxRate.setVisibility(View.VISIBLE);
                        } else {
                            binding.demanderBasics.offer.taxRate.setVisibility(View.GONE);
                        }
                    } else if (id == R.id.tax_rate) {//税率
                        binding.demanderBasics.offer.taxRate.setContent(data.get(options1).getName() + "");
                        bean.setTaxRate(binding.demanderBasics.offer.taxRate.getContent() + "");
                    } else if (id == R.id.unit_measure) {//单位
                        binding.demanderList.unitMeasure.setContent(data.get(options1).getName() + "");
                        bean.setUnitName(binding.demanderList.unitMeasure.getContent() + "");
                        bean.setUnit(data.get(options1).getNo() + "");
                    } else if (id == R.id.faction_user) {//通知人员
                        binding.demanderRule.offer.factionUser.setContent(data.get(options1).getName() + "");
                        List<ReceiversBean> mqReceivers = new ArrayList<>();
                        ReceiversBean receiversBean = new ReceiversBean();
                        receiversBean.setUserName(binding.demanderRule.offer.factionUser.getContent() + "");
                        receiversBean.setUserNo(data.get(options1).getNo() + "");
                        receiversBean.setImAccount(data.get(options1).getImAccount() + "");
                        mqReceivers.add(receiversBean);
                        joinpush.setMqReceivers(mqReceivers);
                    } else if (id == R.id.count_user) {//通知人员
                        binding.demanderRule.offer.countUser.setContent(data.get(options1).getName() + "");
                        List<ReceiversBean> Receivers = new ArrayList<>();
                        ReceiversBean receivers = new ReceiversBean();
                        receivers.setUserName(binding.demanderRule.offer.factionUser.getContent() + "");
                        receivers.setUserNo(data.get(options1).getNo() + "");
                        receivers.setImAccount(data.get(options1).getId() + "");
                        Receivers.add(receivers);
                        offerpush.setMqReceivers(Receivers);
                    } else if (id == R.id.charge_way) {//服务费收取方式
                        binding.demanderRule.serviceCharge.chargeWay.setContent(data.get(options1).getName() + "");
                        dtoBean.setStandardOfServiceCharges(data.get(options1).getNo() + "");
                        switch (data.get(options1).getNo()) {
                            case "1"://按照成交额比例收取
                                binding.demanderRule.serviceCharge.chargeProportion.setVisibility(View.VISIBLE);
                                binding.demanderRule.serviceCharge.llCost.setVisibility(View.GONE);
                                break;
                            case "2"://按照每单固定收费
                                binding.demanderRule.serviceCharge.chargeProportion.setVisibility(View.GONE);
                                binding.demanderRule.serviceCharge.llCost.setVisibility(View.VISIBLE);
                                break;
                            case "3"://供方承担
                            case "4"://需方承担
                                binding.demanderRule.serviceCharge.chargeProportion.setVisibility(View.GONE);
                                binding.demanderRule.serviceCharge.llCost.setVisibility(View.GONE);
                                break;
                        }
                    } else if (id == R.id.shipping_method) {//送货方式
                        binding.demanderRule.delivery.shippingMethod.setContent(data.get(options1).getName() + "");
                        dtoBean.setDeliveryMethod(data.get(options1).getNo());
                        switch (data.get(options1).getNo()) {
                            case "1"://需方自提
                                binding.demanderRule.delivery.llSupplierDistribution.setVisibility(View.GONE);
                                binding.demanderRule.delivery.llSenderDelivery.setVisibility(View.GONE);
                                break;
                            case "2"://供方配送
                                binding.demanderRule.delivery.llSupplierDistribution.setVisibility(View.VISIBLE);
                                binding.demanderRule.delivery.llSenderDelivery.setVisibility(View.GONE);
                                binding.demanderRule.delivery.unitName.setText("元/" + bean.getUnitName());
                                break;
                            case "3"://发送方配送
                                binding.demanderRule.delivery.llSupplierDistribution.setVisibility(View.GONE);
                                binding.demanderRule.delivery.llSenderDelivery.setVisibility(View.VISIBLE);
                                MethodListData();
                                break;
                        }
                    }
                }
            }).setCancelColor(Color.parseColor("#666666"))
                    .setSubCalSize(15)
                    .setTitleColor(Color.parseColor("#969696")).setTitleSize(15)
                    .setSubmitColor(Color.parseColor("#5792FD")).build();
            mCustomerOptions.setTitleText(titles);
            mCustomerOptions.setPicker(data);
            mCustomerOptions.setSelectOptions(0);
            mCustomerOptions.show();
        }
    }

    /**
     * 按类型设置监督人
     *
     * @param titles
     * @param bean
     * @param data
     */
    private void showSuperviseListPop(String titles, SuperviseListBean bean, List<JiCaiPublishListBean> data) {
        if (data != null && data.size() > 0) {
            OptionsPickerView<JiCaiPublishListBean> mCustomerOptions = new OptionsPickerBuilder(this, new OnOptionsSelectListener() {
                @Override
                public void onOptionsSelect(int options1, int options2, int options3, View v) {
                    bean.setSuperviseUserName(data.get(options1).getName());
                    bean.setSuperviseUserMemberNo(data.get(options1).getNo());
                    superviseadapter.notifyDataSetChanged();
                }
            }).setCancelColor(Color.parseColor("#666666"))
                    .setSubCalSize(15)
                    .setTitleColor(Color.parseColor("#969696")).setTitleSize(15)
                    .setSubmitColor(Color.parseColor("#5792FD")).build();
            mCustomerOptions.setTitleText(titles);
            mCustomerOptions.setPicker(data);
            mCustomerOptions.setSelectOptions(0);
            mCustomerOptions.show();
        }
    }

    /**
     * 发起单位
     *
     * @param data
     */
    public void setCompanyList(List<JiCaiPublishListBean> data, View view, boolean isShow) {
        this.companyList = data;
        if (isShow) {
            showListPop("发起单位", view, companyList);
        } else {
            for (JiCaiPublishListBean jiCaiPublishListBean : companyList) {
                if (jiCaiPublishListBean.getName().equals(company_name)) {
                    bean.setPickCompanyId(jiCaiPublishListBean.getId());
                    bean.setCompanyId(jiCaiPublishListBean.getId());
                }
            }
        }
    }


    private void initPopWindow() {
        if (goodsTypePopWindow == null) {
            goodsTypePopWindow = new GoodsTypePopWindow(this);
        }
        goodsTypePopWindow.setBgView(binding.grayLayout);
        goodsTypePopWindow.setOnResultClick(new BasePopWindow.OnResultClick() {
            @Override
            public void result(Object key1, Object key2, Object key3) {
                GoodsPublishEntity goodsPublishEntity = (GoodsPublishEntity) key1;
                //一级分类业务名称、业务编号
                if (!TextUtils.isEmpty(goodsPublishEntity.getCid1Name()) && !TextUtils.isEmpty(goodsPublishEntity.getCid1())) {
                    bean.setFirstTypeName(goodsPublishEntity.getCid1Name());
                    bean.setFirstType(goodsPublishEntity.getCid1());
                }
                //二级分类业务名称、业务编号
                if (!TextUtils.isEmpty(goodsPublishEntity.getCid2Name()) && !TextUtils.isEmpty(goodsPublishEntity.getCid2())) {
                    bean.setSecondTypeName(goodsPublishEntity.getCid2Name());
                    bean.setSecondType(goodsPublishEntity.getCid2());
                }
                //三级分类业务名称、业务编号
                if (!TextUtils.isEmpty(goodsPublishEntity.getCid3Name()) && !TextUtils.isEmpty(goodsPublishEntity.getCid3())) {
                    bean.setThirdTypeName(goodsPublishEntity.getCid3Name());
                    bean.setThirdType(goodsPublishEntity.getCid3());
                }
                binding.demanderList.goodsType.setContent(goodsPublishEntity.getCid1Name() + "/" + goodsPublishEntity.getCid2Name() + "/" + goodsPublishEntity.getCid3Name());
                binding.demanderList.unitMeasure.setContent("");
                bean.setUnitName("");
                bean.setUnit("");
                viewModel.getSku(goodsPublishEntity.getCid3());
            }
        });
    }

    /**
     * 省市的选择
     *
     * @param titles
     * @param views
     */
    private void showCityPop(String titles, View views) {
        CityPickView cityOption = new CityPickBuilder(this, new OnOptionsSelectListener() {
            @Override
            public void onOptionsSelect(int options1, int options2, int options3, View v) {
                int id = views.getId();
                if (id == R.id.shipping_address) {//收货地址
                    binding.demanderBasics.basic.shippingAddress.setContent(addressEntityList.get(options1).getName() + " / " + opt2.get(options1).get(options2).getName());
                    bean.setReceiptProvinceName(addressEntityList.get(options1).getName() + "");
                    bean.setReceiptProvinceNo(addressEntityList.get(options1).getId() + "");
                    bean.setReceiptCityName(opt2.get(options1).get(options2).getName() + "");
                    bean.setReceiptCityNo(opt2.get(options1).get(options2).getId() + "");
                } else if (id == R.id.jicai_scope) {//集采范围
                    binding.demanderBasics.basic.jicaiScope.setContent(addressEntityList.get(options1).getName() + " / " + opt2.get(options1).get(options2).getName());
                    bean.setProvinceName(addressEntityList.get(options1).getName() + "");
                    bean.setProvinceNo(addressEntityList.get(options1).getId() + "");
                    bean.setCityName(opt2.get(options1).get(options2).getName() + "");
                    bean.setCityNo(opt2.get(options1).get(options2).getId() + "");
                }
            }
        }).setCancelText("取消").setSubCalSize(15)
                .setCancelColor(Color.parseColor("#666666"))
                .setTitleText(titles)
                .setTitleColor(Color.parseColor("#969696")).setTitleSize(15)
                .setSubmitText("确定")
                .setSubmitColor(Color.parseColor("#5792FD"))
                .build();
        cityOption.setPicker(addressEntityList, opt2);
        cityOption.setSelectOptions(cityPosition1, cityPosition2);
        cityOption.show();
    }

    /**
     * 发起部门
     *
     * @param data
     */
    public void setDepartmentList(List<JiCaiPublishListBean> data, View view) {
        this.departmentList = data;
        showListPop("发起部门", view, departmentList);
    }

    /**
     * 地址列表数据信息
     *
     * @param data
     */
    public void initAddressData(List<AddressEntity<List<AddressEntity<List<AddressEntity>>>>> data, View view) {
        addressEntityList = data;
        for (int i = 0; i < addressEntityList.size(); i++) {
            opt2.add(addressEntityList.get(i).getChildren());
        }
        if (addressEntityList != null && addressEntityList.size() > 0) {
            showCityPop("选择城市", view);
        }
    }

    /**
     * 付款方式
     *
     * @param data
     */
    public void setPaymentList(List<JiCaiPublishListBean> data, View view) {
        this.paymentList = data;
        showListPop("选择付款方式", view, paymentList);
    }

    /**
     * 发票类型
     *
     * @param data
     */
    public void setInvoiceList(List<JiCaiPublishListBean> data, View view) {
        this.invoiceList = data;
        showListPop("选择发票类型", view, invoiceList);
    }

    /**
     * 税率
     *
     * @param data
     */
    public void setTaxRateList(List<JiCaiPublishListBean> data, View view) {
        this.taxRateList = data;
        showListPop("选择税率", view, taxRateList);
    }

    /**
     * 单位信息
     *
     * @param data
     */
    public void setUnitList(List<JiCaiPublishListBean> data, View view) {
        this.unitList = data;
        showListPop("选择计量单位", view, unitList);
    }

    /**
     * 展示商品类型
     */
    private void showGoodsTypePop() {
        if (!goodsTypePopWindow.isShowing()) {
            goodsTypePopWindow.showDownPopwindow(binding.grayLayout, true);
        }
    }

    /**
     * 商品返回数据信息
     *
     * @param data
     */
    public void showGoodsTypePop(List<MenuEntity<MenuEntity<MenuEntity>>> data) {
        this.goodsTypeEntityList = data;
        if (!goodsTypePopWindow.isShowing()) {
            goodsTypePopWindow.showDownPopwindow(binding.grayLayout, true);
        }
        goodsTypePopWindow.setData(goodsTypeEntityList);
    }

    @Override
    public void onBackPressed() {
        if (binding.demanderRule.getRoot().getVisibility() == View.VISIBLE) {
            binding.demanderBasics.getRoot().setVisibility(View.GONE);
            binding.demanderList.getRoot().setVisibility(View.VISIBLE);
            binding.demanderRule.getRoot().setVisibility(View.GONE);
            binding.demanderContentProgress.setProgressbar(75);
        } else if (binding.demanderList.getRoot().getVisibility() == View.VISIBLE) {
            binding.demanderBasics.getRoot().setVisibility(View.VISIBLE);
            binding.demanderList.getRoot().setVisibility(View.GONE);
            binding.demanderRule.getRoot().setVisibility(View.GONE);
            binding.demanderContentProgress.setProgressbar(25);
        } else if (binding.demanderBasics.getRoot().getVisibility() == View.VISIBLE) {
            initDialog();
        }
    }

    public void initDialog() {
        new CommonDialog(getActivity()).builder().setPositiveButton("确定").setNegativeButton("取消")
                .setTitle("温馨提示")
                .setMsg("所填写的内容不会保存,确认离开？")
                .setDialogCallBack(new CommonDialog.DialogCallBack() {
                    @Override
                    public void onRightClick() {
                        setResult(Activity.RESULT_OK, new Intent());
                        JiCaiDemanderPublishAct.this.finish();
                    }

                    @Override
                    public void onLeftClick() {
                        return;
                    }
                }).show();
    }

    /**
     * 质保周期单位
     *
     * @param bean
     */
    public void setDepositRateUnit(List<JiCaiPublishListBean> bean, View view) {
        this.DepositRateUnit = bean;
        showListPop("选择质保金", view, DepositRateUnit);
    }
    /**
     * 质保周期单位
     *
     * @param bean
     */
    public void setTimeUnit(List<JiCaiPublishListBean> bean, View view) {
        this.timeUnit = bean;
        showListPop("选择质保周期", view, timeUnit);
    }

    /**
     * 集采类型
     *
     * @param bean
     * @param view
     */
    public void setJiCaiTypeList(List<JiCaiPublishListBean> bean, View view) {
        this.jicaiTypeList = bean;
        showListPop("选择集采类型", view, jicaiTypeList);
    }

    /**
     * 供方要求
     *
     * @param bean
     * @param view
     */
    public void setSupplierRequireList(List<JiCaiPublishListBean> bean, View view) {
        this.supplierRequireList = bean;
        showListPop("选择供方要求", view, supplierRequireList);
    }

    /**
     * 注册资金
     *
     * @param bean
     * @param view
     */
    public void setRegisteredFundList(List<JiCaiPublishListBean> bean, View view) {
        this.registeredFundList = bean;
        showListPop("选择注册资金", view, registeredFundList);
    }

    /**
     * 经营业绩
     *
     * @param bean
     * @param view
     */
    public void setOperationResultList(List<JiCaiPublishListBean> bean, View view) {
        this.operationResultList = bean;
        showListPop("选择经营业绩", view, operationResultList);
    }

    /**
     * 存货要求
     *
     * @param bean
     * @param view
     */
    public void setInventoryRequirementsList(List<JiCaiPublishListBean> bean, View view) {
        this.inventoryRequirementsList = bean;
        showListPop("选择存货要求", view, inventoryRequirementsList);
    }

    /**
     * 专业要求
     *
     * @param bean
     * @param view
     */
    public void setProfessionRequireList(List<JiCaiPublishListBean> bean, View view) {
        this.professionRequireList = bean;
        showListPop("选择专业要求", view, professionRequireList);
    }

    /**
     * 物料清单集合
     *
     * @param skuList
     */
    private void JiCaiListAdapter(List<CommodityParamValBean> skuList) {
        shoplist = new ArrayList<>();
        ShoplistBean addshoplist = new ShoplistBean();//最外层
        List<AttrsListBean> attrsList = new ArrayList<>();
        if (skuList != null && skuList.size() > 0) {
            for (CommodityParamValBean valBean : skuList) {
                AttrsListBean attrs = new AttrsListBean();
                attrs.setName(valBean.getName());
                attrs.setSku(valBean.getSku());
                List<GoodsDetailBean> goodsDetailBeans = new ArrayList<>();
                for (CommodityParamValBean.DataDTO datum : valBean.getData()) {
                    goodsDetailBeans.add(new GoodsDetailBean(datum.getBrandId(), datum.getBrandName()));
                }
                attrs.setGoodsDetailBeans(goodsDetailBeans);
                attrsList.add(attrs);
            }
            addshoplist.setAttrs(attrsList);
            addshoplist.setIndex(1);
            addshoplist.setNum("");
            addshoplist.setRangeBrands("");
            addshoplist.setExitTime("");
            addshoplist.setEntranceTime("");
            addshoplist.setPickTime("");
            addshoplist.setStartTime(bean.getDeadline());
            addshoplist.setGroupbuyClass(bean.getGroupbuyClass());
            addshoplist.setFirstType(bean.getFirstType());
            addshoplist.setFirstTypeName(bean.getFirstTypeName());
            addshoplist.setSecondType(bean.getSecondType());
            addshoplist.setSecondTypeName(bean.getSecondTypeName());
            addshoplist.setThirdType(bean.getThirdType());
            addshoplist.setThirdTypeName(bean.getThirdTypeName());
            addshoplist.setUnitName(bean.getUnitName());
            addshoplist.setGoodsMaterial("");//商品材料
            addshoplist.setGoodsQuality("");//质量标准
            addshoplist.setGoodsMaintenance("");//维修保养
            addshoplist.setGoodsPurpose("");//商品用途
            addshoplist.setGoodsDescribe("");//特征描述
            shoplist.add(addshoplist);
        }
        adapter.setDatas(shoplist);
    }

    /**
     * 送货方式list处理
     */
    private void MethodListData() {
        List<FreightRulesBean> shipinglist = new ArrayList<>();
        FreightRulesBean shiping = new FreightRulesBean();
        shiping.setUnitName(bean.getUnitName());
        shipinglist.add(shiping);
        methodadapter = new MethodAdapter(this, shipinglist);
        binding.demanderRule.delivery.shippingMethodList.setLayoutManager(new LinearLayoutManager(getActivity()));
        binding.demanderRule.delivery.shippingMethodList.setAdapter(methodadapter);
        methodadapter.setOnDelete(new MethodAdapter.onDelete() {
            @Override
            public void Delete() {
                List<FreightRulesBean> datas = methodadapter.getDatas();
                if (datas.size() < 5) {
                    //如果发送方配送list小于4个新增按钮展示出来
                    binding.demanderRule.delivery.addDelivery.setVisibility(View.VISIBLE);
                }
            }
        });
    }

    /**
     * 机械列表
     *
     * @param data
     */
    public void getMachineTypeSucc(List<PublicTypeEntity<List<PublicTypeEntity>>> data) {
        this.publicTypeEntityList = data;
        startActivityForResult(new Intent(getApplicationContext(), JiCaiDeviceTypeActivity.class).putExtra("publicTypeEntityList", (Serializable) publicTypeEntityList),100101);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
         super.onActivityResult(requestCode, resultCode, data);
        if (resultCode == RESULT_OK) {
            if (requestCode == 100101) {
                ReturnTypeEntity returnTypeEntity = (ReturnTypeEntity) data.getSerializableExtra("data");
                if (returnTypeEntity != null) {
                    binding.demanderList.goodsType.setContent(returnTypeEntity.getFirstName() + "/" + returnTypeEntity.getSecondName());
                    //一级
                    bean.setFirstType(returnTypeEntity.getFirstNo());
                    bean.setFirstTypeName(returnTypeEntity.getFirstName());
                    //二级
                    bean.setSecondType(returnTypeEntity.getSecondNo());
                    bean.setSecondTypeName(returnTypeEntity.getSecondName());
                    bean.setThirdType("");
                    bean.setThirdTypeName("");
                    viewModel.getDeviceAttr(bean.getGroupbuyClass(), bean.getFirstType(), bean.getSecondType());
                }
            }
            if (requestCode == 100202) {
                ReturnTypeEntity returnTypeEntity = (ReturnTypeEntity) data.getSerializableExtra("data");
                if (returnTypeEntity != null) {
                    binding.demanderList.goodsType.setContent(returnTypeEntity.getFirstName() + "/" + returnTypeEntity.getSecondName());
                    //一级
                    bean.setFirstType(returnTypeEntity.getFirstNo());
                    bean.setFirstTypeName(returnTypeEntity.getFirstName());
                    //二级
                    bean.setSecondType(returnTypeEntity.getSecondNo());
                    bean.setSecondTypeName(returnTypeEntity.getSecondName());
                    bean.setThirdType("");
                    bean.setThirdTypeName("");
                    viewModel.getDeviceAttr(bean.getGroupbuyClass(), bean.getFirstType(), bean.getSecondType());
                }
            }
        }
    }

    /**
     * 设备列表
     *
     * @param data
     */
    public void showDeviceType(List<PublicTypeEntity<List<PublicTypeEntity>>> data) {
        this.equipmentList = data;
        startActivityForResult(new Intent(getApplicationContext(), JiCaiDeviceTypeActivity.class).putExtra("publicTypeEntityList", (Serializable) equipmentList),100202);
    }

    /**
     * 设备和机械属性
     *
     * @param data
     */
    public void setAttr(List<FilterEntity<List<FilterEntity>>> data) {
        this.filterList = data;
        DeviceMachineDetailed(data);
    }

    /**
     * 设备、机械清单数据信息
     *
     * @param data
     */
    private void DeviceMachineDetailed(List<FilterEntity<List<FilterEntity>>> data) {
        shoplist = new ArrayList<>();
        if (data != null && data.size() > 0) {
            List<AttrsListBean> attrsList = new ArrayList<>();
            for (FilterEntity<List<FilterEntity>> datum : data) {
                AttrsListBean att = new AttrsListBean();
                att.setSku("0");
                unit = datum.getUnit();
                att.setName(datum.getName());
                if (datum.getChildren() != null && datum.getChildren().size() > 0) {
                    List<GoodsDetailBean> skuList = new ArrayList<>();
                    for (FilterEntity child : datum.getChildren()) {
                        skuList.add(new GoodsDetailBean( child.getAttributeNo(),child.getStartVal()+unit));
                    }
                    att.setGoodsDetailBeans(skuList);
                }
                attrsList.add(att);
            }
            ShoplistBean addshoplist = new ShoplistBean();
            addshoplist.setAttrs(attrsList);
            addshoplist.setIndex(1);
            addshoplist.setFirstType(bean.getFirstType());
            addshoplist.setFirstTypeName(bean.getFirstTypeName());
            addshoplist.setSecondType(bean.getSecondType());
            addshoplist.setSecondTypeName(bean.getSecondTypeName());
            addshoplist.setThirdType(bean.getThirdType());
            addshoplist.setThirdTypeName(bean.getThirdTypeName());
            addshoplist.setUnitName(bean.getUnitName());
            addshoplist.setNum("");
            addshoplist.setRangeBrands("");
            addshoplist.setStartTime(bean.getDeadline());
            addshoplist.setExitTime("");
            addshoplist.setEntranceTime("");
            addshoplist.setPickTime("");
            addshoplist.setGroupbuyClass(bean.getGroupbuyClass());
            shoplist.add(addshoplist);
        } else {
            ShoplistBean addshoplist = new ShoplistBean();
            addshoplist.setAttrs(new ArrayList<>());
            addshoplist.setIndex(1);
            addshoplist.setFirstType(bean.getFirstType());
            addshoplist.setFirstTypeName(bean.getFirstTypeName());
            addshoplist.setSecondType(bean.getSecondType());
            addshoplist.setSecondTypeName(bean.getSecondTypeName());
            addshoplist.setThirdType(bean.getThirdType());
            addshoplist.setThirdTypeName(bean.getThirdTypeName());
            addshoplist.setUnitName(bean.getUnitName());
            addshoplist.setNum("");
            addshoplist.setRangeBrands("");
            addshoplist.setStartTime(bean.getDeadline());
            addshoplist.setExitTime("");
            addshoplist.setEntranceTime("");
            addshoplist.setPickTime("");
            addshoplist.setGroupbuyClass(bean.getGroupbuyClass());
            shoplist.add(addshoplist);
        }
        adapter.setDatas(shoplist);
    }


    /**
     * 服务费收取方式
     *
     * @param bean
     * @param view
     */
    public void setChargeWayList(List<JiCaiPublishListBean> bean, View view) {
        this.chargeWayList = bean;
        showListPop("选择收取方式", view, chargeWayList);
    }

    /**
     * 送货方式
     *
     * @param bean
     * @param view
     */
    public void setShippingMethodList(List<JiCaiPublishListBean> bean, View view) {
        this.shippingMethodList = bean;
        showListPop("选择送货方式", view, shippingMethodList);
    }

    //发布成功
    public void SucceedView() {
        setResult(Activity.RESULT_OK, new Intent());
        finish();
    }

    /**
     * 商品属性
     *
     * @param data
     */
    public void setSkuList(List<CommodityParamValBean> data) {
        this.skuList = data;
        JiCaiListAdapter(skuList);
    }
}
